package com.opennice.soukaoti.paper.dao.impl;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.opennice.soukaoti.dao.BaseDAO;
import com.opennice.soukaoti.paper.dao.IPaperTopicDAO;
import com.opennice.soukaoti.vo.Paper;
import com.opennice.soukaoti.vo.PaperTopic;

public class PaperTopicDAO extends BaseDAO implements IPaperTopicDAO {

	@Override
	public PaperTopic getPaperTopic(int pfid) {
		Session session = getSession();
		Transaction tx = session.beginTransaction();
		PaperTopic paperTopic = (PaperTopic) session.load(PaperTopic.class, pfid);
		tx.commit();
		session.close();
		return paperTopic;
	}

	@Override
	public void savePaperTopic(PaperTopic paperTopic) {
		Session session = getSession();
		Transaction tx = session.beginTransaction();
		session.save(paperTopic);
		tx.commit();
		session.close();
	}
	@Override
	public void updatePaperTopic(PaperTopic paperTopic) {
		Session session = getSession();
		Transaction tx = session.beginTransaction();
		session.update(paperTopic);
		tx.commit();
		session.close();
	}

}
